const moment = require('moment');
const { Schema, model } = require('mongoose');

const usersSchema = new Schema({
    nickName: String,
    province: String,
    language: String,
    gender: Number,
    country: String,
    openid: String,
    isVip: {
        type: Boolean,
        default: false
    },
    avatarUrl: {
        type: String,
        default: 'zu428@2x.png'
    },
    money: {
        type: Number,
        default: 0
    },
    collect: [{
        type: Schema.Types.ObjectId,
        ref: 'foodsModel'
    }],
    browse: [{
        type: Schema.Types.ObjectId,
        ref: 'foodsModel'
    }],
    likes: [{
        type: Schema.Types.ObjectId,
        ref: 'foodsModel'
    }]
}, { versionKey: false });

const usersModel = model('usersModel', usersSchema, 'users');

module.exports.usersModel = usersModel;